package com.jiaoxiaobo.exchange.topic;

import com.jiaoxiaobo.RabbitMQUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class TopicExchangeProducer {

    private static final String EXCHANGE_NAME = "topicExchange-20240913";

    public static void main(String[] args) throws Exception {
        Connection connection = RabbitMQUtil.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME,"topic");
        String message = "LOG INFO";
        channel.basicPublish(EXCHANGE_NAME, "anonymous.info", null, message.getBytes());
        channel.basicPublish(EXCHANGE_NAME, "tuling.loulan.debug", null, message.getBytes());
        channel.close();
        connection.close();
    }

}
